package cn.edu.zut.bigdata.hdfs;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.conf.Configuration;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

public class HDFSOperate {
    public static void main(String[] args) throws Exception {
        Configuration conf=new Configuration();
        //conf.set("dfs.replication","1");//设置副本数,加配置文件
        //conf.set("fs.defaultFS","hdfs://node01:9000");//加配置文件
        //加环境变量
        //1.创建HDFS文件系统对象
        FileSystem fs= FileSystem.get(new URI("hdfs://node01:9000"),conf,"root");//user不写默认本地用户名
        fs.copyFromLocalFile(new Path("D:\\下载\\jdk-8u441-windows-x64.zip"),new Path("/a"));
        fs.close();
    }
}
